home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: MegaDisc / MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].zip / MegaDisc 27 (1992-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].adf / Tutes_&_CLI / Basic_Programming / Basic_Programming
Text File  |  1992-03-30  |  9KB  |  171 lines

  1.  
  2.  
  3.  
  4.              PAINLESS PROGRAMMING IN AmigaBASIC  
  5.  
  6.  
  7.                         by Keith Antoine
  8.  
  9.  
  10.    Ed: Here is a tutorial for beginners who want to get into Basic - it
  11.   covers how to set up a Basic disk, and start off programming.
  12.  
  13.  
  14.    (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))
  15.  
  16.  
  17.  
  18.    I have been for some time trying to program in the "simple" AmigaBasic,
  19.   quite unsuccessfully I might say.  The why's and wherefore's are that the
  20.   language was never written with the idea of being able to use the more
  21.   powerful interfaces of the Amiga without a great deal of trouble. There
  22.   have appeared from time to time what appeared to many as the answer, in the
  23.   form of other languages such as AMOS, but theses like C and assembler take
  24.   time to learn.  There is also the drawback of the writers of such languages
  25.   being unable to either speak or write in ENGLISH so as lay-people can
  26.   understand what they are saying. It would seem as if they never attended
  27.   either school or English classes, and therefore it should be a rule that
  28.   the developers themselves not be allowed near the writing of manuals.
  29.  
  30.    It was with some suprise one day whilst looking through a catalogue of
  31.   public domain for examples of C, so as I might edify myself, that I came
  32.   across a program called "Basic Gadgets" by Bryan D. Catley.  I thought
  33.   that if one person can program using the intuition so easily then others
  34.   may have done so also, using other equally difficult libraries, etc in a
  35.   simple way so as I could use and understand them. So the search began
  36.   for the holy program.
  37.  
  38.    Let us start from the beginning. I am 58 and had a decent education but I
  39.   have become recently unemployed and in the present economic climate I have
  40.   as much hope of being re-employed as I have of becoming Prime Minister of
  41.   Australia, actually the latter would be more obtainable.  I had purchased
  42.   in July 1990 an Amiga 500 plus printer- external drive - monitor -0.5meg
  43.   memory expansion and as I was very interested in Astrology as well and
  44.   wanted to take the hard work out of it I thought I will write my own
  45.   program!!  OK! you can all stop laughing. I had owned a Vic 20 and a C64
  46.   previously and I had read the small manual that came with the Vic 20 and I
  47.   imagined it was a simple task - how wrong can you be. Eighteen months
  48.   later I purchased the astrology programs admitting defeat over what was
  49.   after all a gigantic task.
  50.  
  51.    I was still interested in programming, but with greatly reduced horizons
  52.   and a better understanding of the subject and why many books start off with
  53.   "HELLO WORLD" type programs, which I thought were beneath me. I have
  54.   nearly finished my first program and another on the way, but they would not
  55.   have got off the ground if it were not for the people who put their work
  56.   into public domain. I actually found many such programs were available
  57.   based on advanced basic using libraries which can be called as sub
  58.   programs. [Ed: on this subject, see the "Basic_Routines" drawer this
  59.   issue.]
  60.  
  61.    Practical Stuff
  62.  
  63.    It is a good idea to keep on a disk/s the various sub programs and
  64.   procedures/modules that you use often, to save typing.  One of the best PD
  65.   text editors, in my opinion, available to a programmer is AZ. This is the
  66.   only PD editor to have two windows available and therefore you can cut and
  67.   paste between two separate documents this enables you to join parts of or
  68.   whole programs together without using MERGE or JOIN. In other words it
  69.   makes programming a breeze and not a chore.
  70.  
  71.    No Bugs?
  72.  
  73.    Programming must be for the amateurs like us, a relaxation the culmination
  74.   of which is to see something you put many hours of BLOOD SWEAT AND TEARS
  75.   into working on the screen. I suppose I am something of a perfectionist
  76.   therefore make sure before you let anyone else use your program that there
  77.   are no bugs in it and it is the best work you can produce. I am sick to
  78.   death after paying good money for either PD or commercial programs to find
  79.   they do not work properly, hence let us lowly types who program in basic
  80.   show the rest of the programming fraternity the right way to do things.
  81.  
  82.    Books to use
  83.  
  84.    Now the first recommendation I have is throw away the Commodore booklet on
  85.   Amiga Basic aqnd purchase three books two by Abacus, "Amiga Basic Inside
  86.   and Out" and also "Amiga Tricks and Tips", plus the accompanying Disks.  I
  87.   would also reccommend by Compute "Advanced Amiga Basic" - these will give
  88.   you a good grounding in the language.
  89.  
  90.    The AmigaBasic interpreter is a necessary evil during the formation period
  91.   of your program but only in a minor way. It is slow and by no means as
  92.   efficient as an ASCII text editor such as QED or AZ which are both PD. So
  93.   firstly we will make up a disk specifically for the program you are going
  94.   to write. Firstly it does not need to be bootable, initially, but as you
  95.   will eventually want it to be we will make it so.
  96.  
  97.    Making a special disk
  98.  
  99.    Format any disk and install it; to help I suggest another PD Program
  100.   called Formatter which if you select the drive you have your disk in and
  101.   then select fast format and install, click on start, your disk will be
  102.   processed in about 4secs. A PD program entitled SID [Ed: on our PD disk UT
  103.   164] is a veritable workhorse for anyone with a computer and indispensable
  104.   to programmers but please READ the documents. SID can be configured by you
  105.   to your requirements but more of this later we will use it as is for now.
  106.   Click on the icon for SID and it will open with a split screen put in your
  107.   programming disk and workbench disk in df1; immediateley below the screens
  108.   is a line of gadgets the first being RAM and reapeating itself from the
  109.   centre again, click on df0 for the left and df1 for the right. This means
  110.   that your programming disk on the left screen is blank except for an .
  111.   .info file whilst on the right is workbench in all its glory and with files
  112.   you do not see normally, as some do not have icons on workbench to display
  113.   them. In the righthand screen, using the mouse click on the following
  114.   orange coloured directories:- C, DEVS, FONTS, l, LIBS, S, SYSTEM these
  115.   should become highlighted; as soon as this happens click on the gadget that
  116.   is labeled copy this is situated just to the left of centre screen. When
  117.   the directories have copied across eject workbench from df1 and replace
  118.   with the extras disk click on the df1 gadget on the right again to display
  119.   the disk and copy across as previously the files AmigaBASIC and
  120.   AmigaBASIC.info - these are in white immediately below the orange
  121.   directories.
  122.  
  123.    Quit SID and reset the Amiga and boot up with your new programming disk
  124.   click on the AmigaBASIC icon to open the interpreter and you will be
  125.   presented with a double screen one on the left named "basic" and the other
  126.   "list". The list screen will be active with a cursor in the top lefthand
  127.   corner.
  128.  
  129.     Type the following in and press RETURN at the end of
  130. each line:- CLEAR ,40000&
  131.        '***************************
  132.        '{ the name of the program}
  133.       '{ the date}
  134.             'By {your name}
  135.             'O/S Version {1.3 or 2,04}
  136.             '{the type of program}i.e,GAME,UTILITY,PICTURE 
  137. SAVER etc
  138.             '***************************
  139.  
  140.    At this point it is essential that what you have typed in is saved as an
  141.   ASCII file and not as an AmigaBASIC file so therefore click in the left
  142.   side window labeled basic and type in as follows and press return:-
  143.  
  144. save "{your programs name}",a
  145.  
  146.    In future you will just select SAVE and the program will be saved
  147.   automatically as an ASCII file, and now in future all listing for the
  148.   program will be done from the text editor and you will only use the Basic
  149.   Interpreter to run the program. This is achieved by double clicking on
  150.   the program icon to load into the BASIC interperater or loading into your
  151.   favorite Text Editor.
  152.  
  153.    It does not matter which of the languages you set out to use you will have
  154.   to learn the syntax and the peculiarities of that language and, I am sure
  155.   you are aware that some are more difficult to grasp than others. With this
  156.   in mind I would suggest at this point you purchase, beg, borrow at least
  157.   one of the aformentioned books and digest its contents before the next
  158.   issue of MEGADISK. I will be going into more detail in the next issue on
  159.   the programs available, both commercially and in PD, that will assist you
  160.   in writing more powerful code without having to learn too much computerese.
  161.  
  162.              TO BE CONTINUED
  163.  
  164.    I am Keith Antoine and available on (07) 300 2161 most days or 18 Arkana
  165.   Street, The Gap, Brisbane, QLD 4061
  166.  
  167.  
  168.    (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 )) (( 27 ))
  169.  
  170.  
  171.